<?php
/**
 * +----------------------------------------------------------------------
 * | 自定义标签
 * +----------------------------------------------------------------------
 */
namespace app\common\taglib\iemoo;


use app\common\model\Archives as ArchivesModel;
use app\common\model\Category as CategoryModel;
use app\common\model\ArchivesFiles as ArchivesFilesModel;
use app\common\model\Files as FilesModel;


class Archives {


    // 通用列表
    Public function get_list($where='', $order='sort desc, update_time desc, id desc', $limit='0',$field='id,category_id,title,keywords,description,author,source,hits,create_time,update_time')
    {

		$list = ArchivesModel::where($where)->field($field)->order($order)->limit($limit)->select();
		foreach($list as $key => $val){
			$list[$key]['images'] = $val->files->toArray();
			if(empty($list[$key]['images'])){
				$list[$key]['thumb'] = '/static/common/images/empty.png';
			}else{
				$list[$key]['thumb'] = $list[$key]['images'][0]['url'];
			}
			
		}

        return $list;
    }



}